import os
from PySide6.QtWidgets import (QDialog, QVBoxLayout, QPlainTextEdit,
                             QPushButton, QDialogButtonBox, QLabel)
from PySide6.QtCore import Qt
from src.ui.i18n import _

class LogDialog(QDialog):
    def __init__(self, parent, video_name, log_text):
        super().__init__(parent)
        self.setWindowTitle(_("Log for {}").format(video_name))
        self.setMinimumSize(700, 500)

        layout = QVBoxLayout(self)

        self.log_edit = QPlainTextEdit()
        self.log_edit.setReadOnly(True)
        self.log_edit.setPlainText(log_text)
        self.log_edit.setLineWrapMode(QPlainTextEdit.NoWrap)
        
        font = self.log_edit.font()
        font.setFamily("Courier New")
        font.setPointSize(10)
        self.log_edit.setFont(font)

        layout.addWidget(self.log_edit)

        button_box = QDialogButtonBox(QDialogButtonBox.Ok)
        button_box.accepted.connect(self.accept)
        layout.addWidget(button_box)

        self.setLayout(layout)